﻿//-----------------------------------------------------------------------
// <copyright file="MessageBoxClassPage.cs" company="Noboru Project">
//      Copyright (c) Noboru Project. All rights reserved.
//
//      This source code is subject to terms and conditions of the New BSD License (BSD).
//      A copy of the license can be found in the License.html file at the root of this 
//      distribution. If you can not locate the New BSD License (BSD), please send an 
//      email to noboru_adm@live.com.
//      By using this source code in any fashion, you are agreeing to be bound by
//      the terms of the New BSD License (BSD) for Noboru.
//
//      You must not remove this notice, or any other, from this software.
// </copyright>
//-----------------------------------------------------------------------

//-----------------------------------------------------------------------
// <copyright file="MessageBoxClassPage.cs" company="Noboru Project">
//      Copyright (c) Noboru Project. All rights reserved.
//
//      This source code is subject to terms and conditions of the New BSD License (BSD).
//      A copy of the license can be found in the License.html file at the root of this 
//      distribution. If you can not locate the New BSD License (BSD), please send an 
//      email to noboru_adm@live.com.
//      By using this source code in any fashion, you are agreeing to be bound by
//      the terms of the New BSD License (BSD) for Noboru.
//
//      You must not remove this notice, or any other, from this software.
// </copyright>
//-----------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Noboru.Windows.Controls;

namespace Noboru.Demo
{
    public partial class MessageBoxClassPage : UserControl
    {
        public MessageBoxClassPage()
        {
            this.InitializeComponent();
        }

        private void toolStripLabelShow_Click(object sender, RoutedEventArgs e)
        {
            Noboru.Windows.Controls.MessageBox messageBox = new Noboru.Windows.Controls.MessageBox();
            messageBox.IsBackgroundGrayed = this.checkIsBackgroundGrayed.IsChecked.Value;

            messageBox.Closed += new EventHandler(this.MessageBox_Closed);

            messageBox.Show("This is a test message.\r\nThe message may contain returns.");
        }

        private void MessageBox_Closed(object sender, EventArgs e)
        {
            string result = string.Empty;
            StringBuilder message = new StringBuilder();

            switch (((Noboru.Windows.Controls.MessageBox)sender).DialogResult)
            {
                case DialogResult.Abort:
                    result = "Abort";
                    break;

                case DialogResult.Cancel:
                    result = "Cancel";
                    break;

                case DialogResult.Ignore:
                    result = "Ignore";
                    break;

                case DialogResult.No:
                    result = "No";
                    break;

                case DialogResult.None:
                    result = "None";
                    break;

                case DialogResult.OK:
                    result = "OK";
                    break;

                case DialogResult.Retry:
                    result = "Retry";
                    break;

                case DialogResult.Yes:
                    result = "Yes";
                    break;
            }

            message.AppendFormat("DialogResult = {0}", result);

            this.txtDialogResult.Text = message.ToString();
        }

        private void toolStripLabelShow2_Click(object sender, RoutedEventArgs e)
        {
            Noboru.Windows.Controls.MessageBox messageBox = new Noboru.Windows.Controls.MessageBox();
            messageBox.IsBackgroundGrayed = this.checkIsBackgroundGrayed.IsChecked.Value;

            messageBox.Closed += new EventHandler(this.MessageBox_Closed);

            messageBox.Show("This is a test message.\r\nThe message may contain returns.", "Test application message");
        }

        private void toolStripLabelShow3_Click(object sender, RoutedEventArgs e)
        {
            Noboru.Windows.Controls.MessageBox messageBox = new Noboru.Windows.Controls.MessageBox();
            messageBox.IsBackgroundGrayed = this.checkIsBackgroundGrayed.IsChecked.Value;

            messageBox.Closed += new EventHandler(this.MessageBox_Closed);

            messageBox.Show("This is a test message.\r\nThe message may contain returns.", "Test application message", MessageBoxButtons.OKCancel);
        }

        private void toolStripLabelShow4_Click(object sender, RoutedEventArgs e)
        {
            Noboru.Windows.Controls.MessageBox messageBox = new Noboru.Windows.Controls.MessageBox();
            messageBox.IsBackgroundGrayed = this.checkIsBackgroundGrayed.IsChecked.Value;

            messageBox.Closed += new EventHandler(this.MessageBox_Closed);

            messageBox.Show("This is a test message.\r\nThe message may contain returns.", "Test application message", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
        }

        private void toolStripLabelShow5_Click(object sender, RoutedEventArgs e)
        {
            Noboru.Windows.Controls.MessageBox messageBox = new Noboru.Windows.Controls.MessageBox();
            messageBox.IsBackgroundGrayed = this.checkIsBackgroundGrayed.IsChecked.Value;

            messageBox.Closed += new EventHandler(this.MessageBox_Closed);

            messageBox.Show("This is a test message.\r\nThe message may contain returns.", "Test application message", MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
        }
    }
}
